"use strict";
import dialogView from "./index.html";
import "./index.less";
export default class Dialog {
  constructor(message, pic,url) {
    this.pic = pic;
    this.url = url;
    this.message = message;
    this.body = $("body");
    this.compiled = _.template(dialogView);
    this.render();
    this.registerEvents();
  }
  registerEvents() {
    let _this = this;
    this.body.delegate(".tips_btn", "click", function () {
      _this.isVisible = false;
      $(".layer").hide();
    });
    this.body.delegate(".enter_btn", "click", function () {
      // _this.isVisible = false;
      // $(".layer").hide();
      window.location.href = _this.url;
    });
  }
  render() {
    let dialogHtml = this.compiled({
      message: this.message,
      pic: this.pic,
      isVisible: true
    });
    this.body.append(dialogHtml);
  }
  set location(value) {
    $(".J_modal_mask").css({
      "height": value.viewPortSize.height + value.scrollSize.scrollY + 10
    });
  }
}
